package com.epoch.servicecourse.controller;

import bean.response.ResponseBean;
import com.epoch.servicecourse.service.TeacherCourseService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
/**
 * public ResponseBean login(@Valid @RequestBody HashMap<String,String> map){
 * 前端传对象： @RequestBody HashMap  post
 * 前端传数据： @RequestParam String get
 */

/**
 * @author admin
 */
@CrossOrigin
@RestController
public class TeacherCourseController {
    @Autowired
    private TeacherCourseService teacherCourseService;

    /**
     * 无参获取课程列表 页面初始化
     * @return
     */
    @ApiOperation(value = "课程板块")
    @GetMapping("epoch/tCourse/getCourseList")
    public ResponseBean getCourseList() {
        return teacherCourseService.getCourseList();
    }

    /**
     * 根据课程Id获取课程
     * @param courseId
     * @return
     */
    @ApiOperation(value = "课程板块")
    @GetMapping("epoch/tCourse/getCourseByCourseId/{courseId}")
    public ResponseBean getCourseByCourseId(@PathVariable("courseId") String courseId) {
        return teacherCourseService.getCourseByCourseId(courseId);
    }

    /**
     * 获取课程 通过课程类型
     * @param typeContent
     * @return
     */
    @GetMapping("epoch/tCourse/getCourseListByTypeContent/{typeContent}")
    public ResponseBean getCourseListByTypeContent(@PathVariable("typeContent") String typeContent, HttpServletRequest request) {
        return teacherCourseService.getCourseListByTypeContent(typeContent);
    }

//    @ApiOperation(value = "课程板块")
//    @GetMapping("epoch/tCourse/getCET46Course")
//    public ResponseBean getCET46Course() {
//        return teacherCourseService.getCET46Course();
//    }

}